import request from '@/utils/request'

// 获取语音库声音列表
export const getVoiceList = () => {
  return request({
    url: '/listening/loadDataList',
    method: 'get'
  })
}

// 生成语音
export const generateVoice = (data) => {
  return request({
    url: '/ttsRecords/synthesizeSpeech',
    method: 'post',
    data
  })
}

// 获取历史记录
export const getHistory = () => {
  return request({
    url: '/ttsRecords/loadDataList',
    method: 'get'
  })
}

// 删除历史记录
export const deleteHistory = (id) => {
  return request({
    url: `/ttsRecords/deleteTtsRecordsById`,
    method: 'get',
    params: { id }
  })
}
//获取克隆状态进度
export const getCloneStatus = (recordId) => {
  return request({
    url: `/ttsRecords/ttsStatus/${recordId}`,
    method: 'get',
  })
}
//上传文件生成语音
export const generateVoiceFromFile = (formData) => {
  return request({
    url: '/ttsRecords/synthesizeFromFile',
    method: 'post',
    headers: {
      'Content-Type': 'multipart/form-data'
    },
    data: formData
  })
}